<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="box">
        <input type="text" v-model="msg">
        {{msg}}
    </div>
    <script src="./js/vue.js"></script>
    <!-- 
        创建    beforeCreate    created
        挂载    beforeMount     mounted
        更新    beforeUpdate    updated
        销毁    beforeDestroy   destroyed
     -->
    <script>
        let vm = new Vue({
            el:"#box",
            data:{
                msg:"张三"
            },
            // 钩子函数
            beforeCreate(){
                console.group("*******beforeCreate*******");
                console.log("el:",this.$el,"data:",this.$data,"msg:",this.msg);
            },
            created(){
                console.group("*******created*******");
                console.log("el:",this.$el,"data:",this.$data,"msg:",this.msg);
                // el 还没有创建 data和msg已经有了
            },
            beforeMount(){
                console.group("*******beforeMount*******");
                console.log("el:",this.$el,"data:",this.$data,"msg:",this.msg);
                // el 虽然有标签，但是里面数据还没有渲染
            },
            mounted(){
                console.group("*******mounted*******");
                console.log("el:",this.$el,"data:",this.$data,"msg:",this.msg);
                // el已经创建完成
            },
            beforeUpdate(){
                console.group("*******beforeUpdate*******");
                console.log("el:",this.$el,"data:",this.$data,"msg:",this.msg);
            },
            updated(){
                console.group("*******updated*******");
                console.log("el:",this.$el,"data:",this.$data,"msg:",this.msg);
            },
            beforeDestroy(){
                console.group("*******beforeDestroy*******");
                console.log("el:",this.$el,"data:",this.$data,"msg:",this.msg);
            },
            destroyed(){
                console.group("*******destroyed*******");
                console.log("el:",this.$el,"data:",this.$data,"msg:",this.msg);
            },
        })
    </script>
</body>
</html>